<template>
    <view>
        <view class="home-top-nav-content" :style="top_content_style">
            <!-- 标题 -->       
            <view class="home-top-nav-title single-text">{{ application_title }}</view>

            <view v-if="header_nav_fixed" class="content-fixed" style="background-color: #f6c133">
                <view class="home-top-nav-title single-text">{{ application_title }}</view>
            </view>
            
            <block>
                <!-- 活动轮播图 -->
                <banner :dailyBanner="dailyBanner"></banner>
            </block>
        </view>

        <view class="content padding-horizontal-main">
            <view v-if="navData.length > 0" class="icon-nav-list">
                <view v-for="(item, index) in navData" :key="index" class="item">
                    <view class="item-content" :data-value="item.event_value" :data-type="item.event_type" @tap="navigation_event" :style="'background-color:' + (item.bg_color || '#fff')">
                        <image :src="item.images_url" mode="aspectFit"></image>
                    </view>
                    <view class="title">{{ item.name }}</view>
                </view>
            </view>

            <!-- 商城公告 -->
            <view class="notice-content" style="margin-bottom: 20rpx" v-if="(common_shop_notice || null) != null">{{ common_shop_notice }}</view>
            
            <!-- 门店 - 插件 -->
           <block>
                <view class="spacing-nav-title padding-horizontal-main">
                    <text class="text-wrapper">门店信息</text>
                </view>
                <realstore-list :storeList="storeList"></realstore-list>
            </block>
            
            <!-- 优惠卡项 -->
            <block>
                <view class="seckill border-radius-main padding-horizontal-main" style="background: url('../../static/images/home-bg.png') no-repeat 0px; margin-bottom: 20rpx">
                    <view class="spacing-nav-title" style="display: flex; justify-content: space-between">
                        <text class="text-wrapper">优惠卡项</text>
                        <navigator hover-class="none" class="arrow-right" style="padding-right: 40rpx; color: #888" url="/pages/goods-category/goods-category" open-type="switchTab">更多</navigator>
                    </view>

                    <view class="rolling-horizontal border-radius-main oh">
                        <view class="goods-list scroll-view-horizontal">
                            <swiper :vertical="false" autoplay="true" :circular="false" :display-multiple-items="discount?.length < 3 ? discount?.length : 3" interval="3000">
                                <block v-for="(item, index) in discount" :key="index">
                                    <swiper-item>
                                        <view class="item border-radius-main oh" style="margin-right: 20rpx; position: relative; height: 100%; background-color: #fff">
                                            <navigator :url="`/pages/daily/discount_detail?dpUuid=${item.dpUuid}`" hover-class="none">
                                                <!--<image
                                                    class="goods-img"
                                                    style="display: block"
                                                    :src="organizationGateway + '/file/download?filepath=' + item.card?.dcPrph[0]?.path"
                                                    mode="aspectFit"
                                                ></image> -->
                                                <image
                                                    class="goods-img"
                                                    style="display: block"
                                                    :src="item.path"
                                                    mode="aspectFit"
                                                ></image>
                                                <view class="goods-base" style="margin-top: 10rpx">
                                                    <view class="goods-title multi-text" style="margin-bottom: 10rpx">{{ item.dpName }}</view>
                                                    <view class="sales-price single-text">{{ "￥" + item.prprice }}</view>
                                                    <view style="display: flex; justify-content: space-between; align-items: center">
                                                        <view class="original-price single-text">{{ "￥" + item.orprice }}</view>
                                                        <view style="margin-right: 35rpx">
                                                            <uni-icons type="cart" size="18" color="#E02020"></uni-icons>
                                                        </view>
                                                    </view>
                                                </view>
                                            </navigator>
                                        </view>
                                    </swiper-item>
                                </block>
                            </swiper>
                        </view>
                    </view>
                </view>
            </block>
            <!-- 推荐项目 -->
            <block>
                <shopping-mall-list :propData="recommend_data" propLocation="0"></shopping-mall-list>
            </block>
        </view>

        <!-- 活动项目列表  活动开始前  预热时间 >  当前时间  <  活动开始时间    -->
        <!--  <view
            v-if="getCountDown(activity.gpReti) < 0 && getCountDown(activity.gpStti) > 0"
            v-for="(item, index) in activityItems"
            style="display: flex; height: auto; padding: 10px; border-bottom: 1px solid #eee"
            @click="goActivityItemDetail($store, $refs, item, setCurrentActivityItem)"
        >
            <view style="width: 160px; position: relative">
                <image style="width: 140px; height: 140px" :src="getActivityItemImage(item.giPrph)" class="img"></image>
            </view>
            <view style="flex: 1">
                <view style="height: 40px; font-weight: 600; font-size: 14px">{{ item?.giName }}</view>
                <view>
                    <text style="color: red; font-weight: 800; font-size: 16px">￥{{ item?.giGppr?.substring(0, 1) }}{{ getNumIndex(item?.giGppr) }}</text>
                    <text style="color: #999; text-decoration: line-through; margin-left: 10px">￥{{ numberFormat(item?.giInpr || 0, 0) }}</text>
                </view>
                <view style="margin-top: 10px; font-size: 12px">
                    活动开始倒计时：
                    <uni-countdown :font-size="12" :second="getCountDown(activity.gpStti)" color="#FFFFFF" background-color="#c1a173" :show-colon="false" />
                </view>
                <view style="display: flex; justify-content: space-between; margin-top: 10px">
                    <view v-if="item?.giGrou === true">
                        <uni-tag :text="item?.giGrpe + '人团'" type="error" :circle="true" size="small" />
                        <text style="font-size: 12px; margin-left: 10px">
                            <text style="color: #ee0a24">{{ item?.giBoqu }}</text>
                            人已预定
                        </text>
                    </view>
                    <view v-else></view>
                    <view>
                        <u-button v-if="checkAppoint(appointment, item.giUuid)" size="small" :disabled="true" type="primary" text="">已预约</u-button>
                        <u-button v-else size="small" type="success" @tap.stop="stop" @click="() => handleOpenAppointment($refs, $store)">预约</u-button>
                    </view>
                </view>
            </view>
        </view> -->

        <!-- 活动项目列表  活动进行中  活动开始时间 < 当前时间  <  活动结束时间    -->
        <!--  <view
            v-else-if="getCountDown(activity.gpStti) <= 0 && getCountDown(activity.gpEnti) >= 0"
            v-for="(item, index) in activityItems"
            style="display: flex; height: auto; padding: 10px; border-bottom: 1px solid #eee"
            @click="goActivityItemDetail($store, $refs, item, setCurrentActivityItem)"
        >
            <view style="width: 160px; position: relative">
                <image style="width: 140px; height: 140px" :src="getActivityItemImage(item.giPrph)" class="img"></image>
            </view>
            <view style="flex: 1">
                <view style="height: 40px; font-weight: 600; font-size: 14px">{{ item?.giName }}</view>
                <view>
                    <text style="color: red; font-weight: 800; font-size: 16px">￥{{ numberFormat(item?.giGppr || 0, 0) }}</text>
                    <text style="color: #999; text-decoration: line-through; margin-left: 10px">￥{{ numberFormat(item?.giInpr || 0, 0) }}</text>
                </view>
                <view style="margin-top: 10px; font-size: 12px">
                    活动结束倒计时：
                    <uni-countdown :font-size="12" :second="getCountDown(activity.gpEnti)" color="#FFFFFF" background-color="#c1a173" :show-colon="false" />
                </view>
                <view style="display: flex; justify-content: space-between; margin-top: 10px">
                    <view v-if="item?.giGrou === true">
                        <uni-tag :text="item?.giGrpe + '人团'" type="error" :circle="true" size="small" />
                    </view>
                    <view v-else></view>
                    <view>
                        <text style="font-size: 12px; margin-left: 5px">
                            <text style="color: #ee0a24">{{ item?.giSaqu }}</text>
                            人已购买
                        </text>
                    </view>
                </view>
            </view>
        </view> -->

        <!-- 活动项目列表  活动已结束  活动结束时间  < 当前时间   -->
        <!--  <view
            v-else="getCountDown(activity.gpEnti) < 0"
            v-for="(item, index) in activityItems"
            style="display: flex; height: auto; padding: 10px; border-bottom: 1px solid #eee"
            @click="goActivityItemDetail($store, $refs, item, setCurrentActivityItem)"
        >
            <view style="width: 160px; position: relative">
                <image style="width: 140px; height: 140px" :src="getActivityItemImage(item.giPrph)" class="img"></image>
            </view>
            <view style="flex: 1">
                <view style="height: 40px; font-weight: 600; font-size: 14px">{{ item?.giName }}</view>
                <view>
                    <text style="color: red; font-weight: 800; font-size: 16px">￥{{ numberFormat(item?.giGppr || 0, 0) }}</text>
                    <text style="color: #999; text-decoration: line-through; margin-left: 10px">￥{{ numberFormat(item?.giInpr || 0, 0) }}</text>
                </view>
                <view style="margin-top: 10px; font-size: 12px"
                    >活动结束倒计时：
                    <uni-countdown :font-size="12" :second="0" color="#FFFFFF" background-color="#c1a173" :show-colon="false" />
                </view>
                <view style="display: flex; justify-content: space-between; margin-top: 10px">
                    <view v-if="item?.giGrou === true">
                        <uni-tag :text="item?.giGrpe + '人团'" type="error" :circle="true" size="small" />
                    </view>
                    <view v-else></view>
                    <view>
                        <uni-tag size="normal" text="活动已结束" />
                    </view>
                </view>
            </view>
        </view>
 -->

        <!-- 结尾 -->
        <bottom-line :propStatus="data_bottom_line_status"></bottom-line>
        
        <!-- 授权微信手机号弹窗 -->
        <uni-popup ref="popup" background-color="#fff">
            <view style="padding: 30px">
                <button type="primary" open-type="getPhoneNumber" @getphonenumber="(e) => decryptPhoneNumber(e, $store, $refs, appid, activity, currentActivityItem)">微信一键授权</button>
            </view>
        </uni-popup>

        <uni-popup ref="couponPopup" background-color="#fff">
            <coupon-popup :activity="activity" :activityItems="activityItems" :appointment="appointment" :callback="getItemAppointment" />
        </uni-popup>
    </view>
</template>

<script>
import { mapMutations, mapGetters } from "vuex";
import {
    getWxPhoneNumber,
    getCustomerByCiPhon,
    createCustomers,
    createPlatformConsumerInfo,
    createCustomerLoginRelationship,
    updateCustomerByCiUuid,
    mergeGuestToCustomer,
    getDailyHomePage,
} from "../../utils/api";
import { userAuthorization, pageBrowseStart, pageBrowseEnd, saveShareRecord } from "../../utils/helper";

var bar_height = parseInt(uni.getSystemInfoSync().statusBarHeight || 0);

export default {
    data() {
        return {
            currentActivityItem: {},
            indicator_dots: false,
            indicator_color: 'rgba(0, 0, 0, .2)',
            indicator_active_color: '#666',
            isBrowse: false,
            pageUserInfo: {},
            music: false,
            application_title: "芭蒂芬",
            top_content_style: "background-image: url(../../static/images/nav-top.png);" + "padding-top:" + (bar_height + 8) + "px",
            data_bottom_line_status: true,
            header_nav_fixed: false,
            navData: [
                {
                    bg_color: "#48CFAE",
                    event_type: "1",
                    event_value: "",
                    images_url: "../../static/icons/1.png",
                    is_need_login: "0",
                    name: "活动",
                },
                {
                    bg_color: "#FF0066",
                    event_type: "2",
                    event_value: "",
                    images_url: "../../static/icons/2.png",
                    is_need_login: "0",
                    name: "返佣",
                },
                {
                    bg_color: "#FF00CC",
                    event_type: "3",
                    event_value: "",
                    images_url: "../../static/icons/4.png",
                    is_need_login: "0",
                    name: "直播",
                },
                {
                    bg_color: "#669999",
                    event_type: "4",
                    event_value: "",
                    images_url: "../../static/icons/3.png",
                    is_need_login: "0",
                    name: "组合",
                },
                {
                    bg_color: "#ff4d20",
                    event_type: "5",
                    event_value: "",
                    images_url: "../../static/icons/1.png",
                    is_need_login: "0",
                    name: "门店",
                },
            ],
            common_shop_notice: "通知：好消息，本店活动将于...",
            recommend_data: [
                // {
                //     color: "#3333FF",
                //     title: "推荐服务",
                //     style_type: "0",
                //     // url: "/pages/goods-category/goods-category",
                //     goods_list: [],
                // },
                {
                    color: "#0066FF",
                    title: "推荐商品",
                    style_type: "1",
                    url: "",
                    goods_list: [
                        {
                            ocPric: "8888.88",
                            detail: {
                                ciAlna: "士大夫士大夫大师傅"
                            }
                        },
                        {
                            ocPric: "6666.66",
                            detail: {
                                ciAlna: "大师傅士大夫士大夫发"
                            }
                        },
                        {
                            ocPric: "6666.66",
                            detail: {
                                ciAlna: "大师傅士大夫士大夫发"
                            }
                        },
                    ],
                },
            ],
            dailyBanner: [1,2,2],
            discount: [
                {
                    dpName:"内衣组合,高端大气,高端大气,高端大气",
                    prprice: 6666.66,
                    orprice: 12222,
                    path: "../../static/test/1.png"
                },
                {
                    dpName:"品牌内衣组合",
                    prprice: 8888.1,
                    orprice: 14444,
                    path: "../../static/test/1.png"
                },
            ],
            storeList: [
                {
                    logo: "../../static/images/hero.png",
                    msg: "营业中",
                    name: "蒋小姐的服装店",
                    time: "09:00-21:00",
                    province_name: "4444",
                    city_name: "5555",
                    county_name: "6666",
                    address: "88888",
                    service_tel: "02788888888",
                    lng: "22.1547",
                    lat: "33.556"
                }
            ]
        };
    },

    async onLoad(params) {
        // 页面传参 params
        if (params.isJump) {
            this.$store.dispatch("personInfo/saveParams", {
                staffId: params.staffId || "",
                shareId: params.shareId || "",
            });
        }

        // 启用微信分享功能
        wx.showShareMenu({
            withShareTicket: true,
            menus: ["shareAppMessage", "shareTimeline"],
        });

        // uni.setEnableDebug({
        //     enableDebug: true,
        // });

        // 加载活动信息
        this.$store.dispatch("activityInfo/loadActivity", {});
        this.$store.dispatch("dailyInfo/loadOnlineRetailerID", {});

        let userInfo = uni.getStorageSync("userInfo");
        if (userInfo?.openId && params.isJump === "yes" && userInfo?.isLogin === true) {
            let rlData = {
                gpUuid: params.gpUuid,
                ciUuid: userInfo.ciUuid,
                clTime: new Date().getUTCTime(),
            };
            if (params.shareId) rlData.scUuid = params.shareId;
            if (params.staffId) rlData.orUuid = params.staffId;
            if (params.shareId || params.staffId) {
                createCustomerLoginRelationship(rlData);
            }
        }
    },

    async onShow() {},

    onHide() {
        pageBrowseEnd(this.pageUserInfo.gbUuid, this.pageUserInfo.gbInti);
        this.isBrowse === false;
    },

    // 下拉刷新
    // onPullDownRefresh() {
    //     console.log(111111111)
    // },

    //监听页面上拉触底行为
    // onReachBottom() {
    // 	console.log(222222222)
    // },
    
    // 页面滚动监听
    onPageScroll: function (e) {
        let top = e.scrollTop > 35 ? 35 : e.scrollTop;
        // let num = top*7;
        // let base = 230;
        // let val = (num > base) ? base : num;
        this.header_nav_fixed = top >= 35 ? true : false;
    },

    computed: {
        ...mapGetters({
            appid: "globalInfo/appid",
            organizationGateway: "globalInfo/organizationGateway",
            globalUserInfo: "personInfo/userInfo",
            activity: "activityInfo/activity",
            activityItems: "activityInfo/activityItems",
            activityBanners: "activityInfo/activityBanners",
            appointment: "activityInfo/appointment",
            defaultImageBase64: "globalInfo/defaultImageBase64",
            orUuid: "dailyInfo/orUuid",
        }),
    },

    watch: {
        globalUserInfo: {
            handler(newValue, oldValue) {
                if (newValue?.openId && newValue?.ciUuid && this.activity.gpUuid)
                    this.$store.dispatch("activityInfo/getItemAppointment", {
                        gpUuid: this.activity.gpUuid,
                        gaApid: newValue.ciUuid,
                    });
            },
            immediate: true,
            deep: true,
        },
        activity: {
            async handler(newValue, oldValue) {
                if (this.isBrowse === false && newValue.gpUuid) {
                    let res = await pageBrowseStart(this.$store, "首页", newValue); // 浏览记录
                    if (res.ciUuid) {
                        this.isBrowse = true;
                        this.pageUserInfo = res;
                    }
                }
                if (newValue.gpName)
                    uni.setNavigationBarTitle({
                        title: newValue.gpName,
                    });
                // this.application_title = newValue.gpName;
            },
            immediate: true,
            deep: true,
        },
        orUuid: {
            async handler(newValue, oldValue) {
                if (newValue) {
                    // let res = await getDailyHomePage(newValue, "wechat_miniapp_home_page_carousel");
                    // console.log(newValue, "wechat_miniapp_home_page_carousel");
                    // console.log(res);
                    // if (res) {
                    //     this.dailyBanner = res.picture || [];
                    //     this.discount = res.discount || [];
                    //     this.recommend_data[0].goods_list = res.service || [];
                    //     this.recommend_data[1].goods_list = res.commodity || [];
                    // }
                }
            },
        },
    },

    methods: {
        ...mapMutations({}),
        setCurrentActivityItem(item) {
            this.currentActivityItem = item;
            this.$store.dispatch("activityInfo/loadCurrentActivityItem", {
                giUuid: item.giUuid,
                gpUuid: item.gpUuid,
            });
        },
        async getItemAppointment(gpUuid, gaApid) {
            this.$store.dispatch("activityInfo/getItemAppointment", {
                gpUuid,
                gaApid,
            });
        },
        navigation_event(e){
            console.log(e)
        },
        goActivityItemDetail: async ($store, $refs, record, callback) => {
            let staffInfo = uni.getStorageSync("staffInfo") || null; // 员工
            if (callback) callback(record);
            if (staffInfo?.orUuid) {
                return uni.navigateTo({
                    url: `/pages/activities/detail?giUuid=${record.giUuid}&gpUuid=${record.gpUuid}`,
                });
            } else {
                let userInfo = uni.getStorageSync("userInfo");
                if (userInfo?.openId) {
                    if (userInfo.phone) {
                        return uni.navigateTo({
                            url: `/pages/activities/detail?giUuid=${record.giUuid}&gpUuid=${record.gpUuid}`,
                        });
                    }
                    $refs.popup.open("bottom");
                } else {
                    const user = await userAuthorization(record.gpUuid);
                    if (user) {
                        $store.dispatch("personInfo/save", {
                            userInfo: user,
                        });
                        if (user?.phone) {
                            return uni.navigateTo({
                                url: `/pages/activities/detail?giUuid=${record.giUuid}&gpUuid=${record.gpUuid}`,
                            });
                        } else $refs.popup.open("bottom");
                    }
                }
            }
        },

        decryptPhoneNumber: async (e, $store, $refs, appid, activity, currentActivityItem) => {
            $refs.popup.close();

            if (e.detail.errMsg !== "getPhoneNumber:ok") return;

            let userInfo = uni.getStorageSync("userInfo"); // 用户信息

            let brwseData = {
                ciUuid: userInfo.ciUuid,
            };

            const phoneInfo = await getWxPhoneNumber({
                appid,
                ...e.detail,
            });
            if (!phoneInfo?.phone_info?.phoneNumber)
                return uni.showToast({
                    title: "没有获取到当前客户的手机号",
                    icon: "error",
                    duration: 2000,
                });

            let resCust = await getCustomerByCiPhon({
                ciPhon: phoneInfo.phone_info.phoneNumber,
            });

            let shareId = uni.getStorageSync("shareId") || ""; // 分享人ID
            let staffId = uni.getStorageSync("staffId") || ""; // 员工ID

            if (!resCust?.ciUuid) {
                let data = {
                    ciPhon: phoneInfo.phone_info.phoneNumber,
                    ciAvat: userInfo.avatarUrl,
                    ciFrom: "新客",
                    ciCity: userInfo.city,
                    ciPrin: userInfo.province,
                    ciAlia: userInfo.nickName,
                    openId: userInfo.openId,
                    appId: appid,
                    orUuid: staffId || null,
                };
                let resId = await createCustomers(data);

                if (resId) {
                    userInfo.ciUuid = resId?.ciUuid;
                    userInfo.phone = phoneInfo.phone_info.phoneNumber;
                    userInfo.isNew = true;
                    userInfo.isLogin = true;

                    $store.dispatch("personInfo/save", {
                        userInfo,
                    });

                    createPlatformConsumerInfo({
                        ciAlia: userInfo.nickName,
                        ciAvat: userInfo.avatarUrl,
                        ciPhon: userInfo.phone,
                        appId: appid,
                        openId: userInfo.openId,
                    });

                    let rlData = {
                        gpUuid: activity.gpUuid,
                        ciUuid: userInfo.ciUuid,
                        clTime: new Date().getUTCTime(),
                    };

                    if (shareId) rlData.scUuid = shareId;
                    if (staffId) rlData.orUuid = staffId;

                    if (staffId || shareId) {
                        createCustomerLoginRelationship(rlData);
                    }
                }
            } else {
                let data = {
                    ciUuid: resCust?.ciUuid,
                    ciPhon: phoneInfo.phone_info.phoneNumber,
                    ciAvat: userInfo.avatarUrl,
                    ciCity: userInfo.city,
                    ciPrin: userInfo.province,
                    ciAlia: userInfo.nickName,
                    openId: userInfo.openId,
                    appId: appid,
                };

                let res1 = await updateCustomerByCiUuid(data);

                if (res1) {
                    userInfo.ciUuid = resCust?.ciUuid;
                    userInfo.phone = phoneInfo.phone_info.phoneNumber;
                    userInfo.isNew = resCust?.ciFrom === "新客" ? true : false;
                    userInfo.ciName = resCust?.ciName;
                    userInfo.isLogin = true;

                    $store.dispatch("personInfo/save", {
                        userInfo,
                    });

                    createPlatformConsumerInfo({
                        ciAlia: userInfo.nickName,
                        ciAvat: userInfo.avatarUrl,
                        ciPhon: userInfo.phone,
                        appId: appid,
                        openId: userInfo.openId,
                    });

                    let rlData = {
                        gpUuid: activity.gpUuid,
                        ciUuid: userInfo.ciUuid,
                        clTime: new Date().getUTCTime(),
                    };
                    if (shareId) rlData.scUuid = shareId;
                    if (staffId) rlData.orUuid = staffId;
                    if (staffId || shareId) {
                        createCustomerLoginRelationship(rlData);
                    }
                }
            }

            brwseData.ciUuidNew = userInfo.ciUuid;
            brwseData.ciAlia = userInfo.nickName;
            brwseData.ciType = userInfo.isNew ? "新客" : "老客";

            mergeGuestToCustomer(brwseData);
            if (currentActivityItem?.giUuid) {
                return uni.navigateTo({
                    url: `/pages/activities/detail?giUuid=${currentActivityItem?.giUuid}&gpUuid=${currentActivityItem?.gpUuid}`,
                });
            }
        },

        checkAppoint: (appointment, giUuid) => {
            let appointIndex = appointment.findIndex((_item) => _item.giUuid === giUuid);
            return appointIndex !== -1;
        },

        async handleOpenAppointment($refs, $store) {
            let userInfo = uni.getStorageSync("userInfo");
            if (userInfo?.openId) {
                if (userInfo.phone) {
                    return $refs.couponPopup.open("bottom");
                } else $refs.popup.open("bottom");
            } else {
                const user = await userAuthorization(this.activity.gpUuid);
                if (user) {
                    $store.dispatch("personInfo/save", {
                        userInfo: user,
                    });
                    if (user?.phone) {
                        return $refs.couponPopup.open("bottom");
                    } else $refs.popup.open("bottom");
                }
            }
        },

        getActivityItemImage(giPrph) {
            let path = "";
            if (typeof giPrph === "string") path = giPrph;
            else if (Array.isArray(giPrph) && giPrph.length > 1) {
                if (typeof giPrph[0] === "string") path = giPrph[0];
                else {
                    if (new Date().getUTCTime() >= this.activity.gpStti) {
                        const item = giPrph.find((item) => item.display === "3");
                        path = item.path || "";
                    } else {
                        const item = giPrph.find((item) => item.display === "2");
                        path = item.path || "";
                    }
                }
            } else if (Array.isArray(giPrph) && giPrph.length === 1) {
                if (typeof giPrph[0] === "string") {
                    path = giPrph[0];
                } else path = giPrph[0].path || "";
            }
            return path ? this.organizationGateway + "/file/download?filepath=" + path : this.defaultImageBase64;
        },
    },

    onShareAppMessage(res) {
        const { staffId, shUuid } = saveShareRecord(this.activity?.gpUuid);
        return {
            title: this.activity?.gpName || "",
            path: `/pages/home/index?isJump=yes&shareId=${shUuid}&staffId=${staffId}&gpUuid=${this.activity?.gpUuid || ""}`,
            imageUrl: this.organizationGateway + "/file/download?filepath=" + this.activityBanners[0]?.info.mmUrl,
        };
    },

    //分享到朋友圈
    onShareTimeline(res) {
        const { staffId, shUuid } = saveShareRecord(this.activity?.gpUuid);
        return {
            title: this.activity?.gpName,
            imageUrl: this.organizationGateway + "/file/download?filepath=" + this.activityBanners[0]?.info.mmUrl,
            query: `isJump=yes&shareId=${shUuid}&staffId=${staffId}&gpUuid=${this.activity?.gpUuid || ""}`,
        };
    },
};
</script>

<style lang="scss" scoped>
.home-top-nav-content {
    background-repeat: no-repeat;
    background-size: 100% auto;
    min-height: 410rpx;
    padding-top: calc(var(--status-bar-height) + 8px);
}

.home-top-nav-title {
    font-weight: bold;
    text-align: left;
    padding: 0 250rpx 0 20rpx;
    height: 37px;
    font-size: 38rpx;
}

.icon-nav-list {
    overflow: hidden;
    margin-bottom: 20rpx;
}

.icon-nav-list .item {
    width: calc(20% - 20rpx);
    float: left;
    padding: 20rpx 10rpx 0 10rpx;
}
.icon-nav-list .item .item-content {
    border-radius: 50%;
    padding: 20rpx;
    text-align: center;
    width: 50rpx;
    height: 50rpx;
    margin: 0 auto;
    -webkit-box-shadow: 0 2px 12px rgb(226 226 226 / 95%);
    box-shadow: 0 2px 12px rgb(226 226 226 / 95%);
}
.icon-nav-list .item image {
    width: 50rpx !important;
    height: 50rpx !important;
}
.icon-nav-list .item .title {
    margin-top: 6rpx;
    font-size: 28rpx;
    text-align: center;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
    color: #888;
}
.notice-content {
    background: #ffffeb
        url("")
        no-repeat 20rpx 12rpx;
    background-size: 34rpx;
    color: #ffa106;
    border: 1px solid #faebd2;
    line-height: 38rpx;
    padding: 10rpx 20rpx 10rpx 66rpx;
    font-size: 26rpx;
    border-radius: 20rpx;
}

/**
 * 优惠卡项- 插件
 */
.seckill .goods-list swiper {
    height: 435rpx !important;
}
.seckill .goods-list .item .goods-img {
    width: 100%;
    height: 240rpx;
}
.seckill .goods-list .goods-base .icon {
    right: 20rpx;
    bottom: 13rpx;
}

.goods-title {
    line-height: 44rpx;
    min-height: 86rpx;
}
</style>
